<template>
  <view>
    <view class="my-search-container" :style="{'background-color':bgc}">
      <view class="my-search-box" :style="{'border-radius':borderRadius+'px'}"
      @click="searchBoxHandler">
        <!-- 使用uni-ui提供的图标组件 -->
        <uni-icons type="search" size="20"></uni-icons>
        <text class="placeholder">搜索</text>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    name: "my-search",
    data() {
      return {

      };
    },
    props:{
      'borderRadius':{
        type:Number,
        default:18
      },
      'bgc':{
        type:String,
        default:'#C00000'
      }
    },
    methods:{
      searchBoxHandler(){
        this.$emit('click');
      }
    }
  }
</script>

<style lang="scss">
  .my-search-container {
    height: 50px;
    // background-color: #c00000;
    padding: 0 10px;
    display: flex;
    align-items: center;

    .my-search-box {
      height: 36px;
      width: 100%;
      background-color: #ffffff;
      // border-radius: 18px;
      display: flex;
      justify-content: center;
      align-items: center;

      .placeholder {
        font-size: 18px;
        margin-left: 10px;
      }
    }
  }
</style>
